# 支付方式页面
from selenium.webdriver.common.by import By
import time


class PageEcshoBackMethodPayment():
    def __init__(self, driver):
        self.drvier = driver

    # 元素定位
    loc_back_install_payment = (By.XPATH, '//div[@id="listDiv"]/table/tbody/tr[3]/td[7]/a',)
    loc_back_determine_installation = (By.XPATH, '/html/body/form/div/table/tbody/tr[7]/td/input[5]')

    loc_back_uninstall_payment = (By.XPATH, '//div[@id="listDiv"]/table/tbody/tr[3]/td[7]/a[1]')

    # 点击按装支付方式_银联电子支付
    def back_install_payment(self):
        self.drvier.find_element(*self.loc_back_install_payment).click()
        # 确定按装

    def back_determine_installation(self):
        self.drvier.find_element(*self.loc_back_determine_installation).click()

    # 点击卸载支付方式_银联电子支付
    def back_uninstall_payment(self):
        self.drvier.find_element(*self.loc_back_uninstall_payment).click()
        # 警告确定卸载
        time.sleep(2)
        self.drvier.switch_to.alert.accept()
